package edu.lingnan.myrule;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author wuyuan
 * @since 2020-06-09 15:13
 *
 * 组件类：需要放在与启动类不同级的位置上，防止被扫描到
 */
@Configuration
public class MyRule {
    /**
     * 实现随机访问
     */
    @Bean
    public IRule wuyuanRule(){
        return new WuyuanRandomRule();//默认是轮询，现在换为自定义规则：WuyuanRandomRule
    }
}
